package com.four.order.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.four.order.service.OrderService;
import com.four.order.service.impl.OrderServicelmpl;

@WebServlet("/deleteOrder.do")
public class DeleleOrderServlet extends HttpServlet{
	//删除功能
		@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		this.doPost(req, resp);
	}
	
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		req.setCharacterEncoding("UTF-8");
		resp.setCharacterEncoding("UTF-8");
		String id = req.getParameter("id");
		OrderService service = new OrderServicelmpl();
		boolean result = service.deleteOrder(id);
		PrintWriter pw = resp.getWriter();
		pw.append(String.valueOf(result));
		pw.flush();
		pw.close();
	}

}
